const { Transform } = require("stream");

class MyTransform extends Transform {
  constructor(options) {
    super(options);
  }

  _transform(chunk, encoding, callback) {
    this.push(chunk.toString().toUpperCase());
    process.nextTick(callback);
  }
}

const myTransform = new MyTransform();
myTransform.write("hello");
myTransform.write("world");
myTransform.end();

myTransform.pipe(process.stdout);
